package com.kuai.common.result.entity;


import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class Result {
	
	private Object data;
	private Object message;
	private long code;
		
	public static Result success(Object data) {
		return new Result().setData(data).setCode(10000).setMessage("请求成功");
	}
	
	public static Result success(Object data,Object message) {
		return new Result().setData(data).setCode(10000).setMessage(message);
	}

	public static Result error(String message) {
		return new Result().setData(null).setCode(10001).setMessage(message);
	}
	
	public static Result fail(Object message) {
		return new Result().setData(null).setCode(10002).setMessage(message);
	}
	
	public static Result fail(long code,Object message) {
		return new Result().setData(null).setCode(code).setMessage(message);
	}
}